package city.spring.modules.material.repository;

import city.spring.modules.material.entity.MaterialQuantityEntity;
import city.spring.modules.material.vo.MaterialQuantityVO;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 存储库：物资库存信息表
 *
 * @author 谢金婷
 * @date 2020-12-15 16:06:31
 */
@Repository
public interface MaterialQuantityRepository extends BaseMapper<MaterialQuantityEntity> {

    /**
     * 根据物资id和仓库id查找该物资
     *
     * @param storehouseId
     * @param materialId
     * @return
     */
    MaterialQuantityEntity getByMaterialIdAndStorehouseId(String materialId, String storehouseId);

    IPage<MaterialQuantityVO> listPage(Page<? extends MaterialQuantityEntity> page, @Param(Constants.WRAPPER) Wrapper<? extends MaterialQuantityEntity> wrapper);

    /**
     * 根据storehouseId查找物资库存表
     *
     * @param storehouseId
     * @return
     */
    List<MaterialQuantityVO> getMaterialByStorehouseId(@Param("storehouseId") String storehouseId);

    /**
     * 根据materialId查询
     *
     * @param materialId
     * @return
     */
    MaterialQuantityEntity getByMaterialId(String materialId);

    IPage<MaterialQuantityVO> MaterialByStorehouseIdlistPage(Page<? extends MaterialQuantityEntity> page, @Param(Constants.WRAPPER) Wrapper<? extends MaterialQuantityEntity> wrapper, @Param("storehouseId") String storehouseId);

    IPage<MaterialQuantityVO> selectlistPage(Page<? extends MaterialQuantityEntity> page, @Param(Constants.WRAPPER) Wrapper<? extends MaterialQuantityEntity> wrapper);
}